<template>
  <div>
    <div><button @click="isShow = !isShow">显示/隐藏</button></div>
    <transition
      name="why"
      enter-active-class="animate__animated animate__backInDown "
      leave-active-class="animate__animated animate__backOutUp animate__delay-2s"
    >
      <!-- animate__delay-2s为触发时间延迟2s -->
      <h2 class="title" v-if="isShow">Hello World</h2>
    </transition>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style lang="less">
.title {
  display: inline-block;
}
// 这里可以改动画持续时间
.animate__animated.animate__backOutUp {
  --animate-duration: 5s;
}
.animate__animated.animate__backInDown {
  --animate-duration: 5s;
}
</style>
